package com.zhiyou100.service;

import com.zhiyou100.mapper.LoginMapper;
import com.zhiyou100.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class LoginService {
    @Autowired
    LoginMapper loginMapper;

    //后台登陆查询
    public User loginBehind(String tel, String password) {
        User user =  loginMapper.loginBehind(tel,password);
        return user;
    }
    //根据用户id查询角色id
    public ArrayList<Integer> findRolesById(int id) {
        ArrayList<Integer> roleIds = loginMapper.findRolesById(id);
        return roleIds;
    }
    //根据角色id查询权限id
    public List<Integer> findPerIdByRoles(ArrayList<Integer> roleIds) {
        List<Integer> perIds =  loginMapper.findPerIdByRoles(roleIds);
        return perIds;
    }
    //根据权限id查询权限
    public List<String> findPerByPerId(List<Integer> perIds) {
        List<String> pers = loginMapper.findPerByPerId(perIds);
        return pers;
    }
}
